package com.yxinsur.imc.business.vo;

import com.yxinsur.imc.business.form.BrokerRoleForm;
import com.yxinsur.imc.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.List;
import java.util.Objects;


@Data
@ToString
public class BrokerRelationVo implements Comparable<BrokerRelationVo> {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("ID")
    private Long id;

    /** 本人的broker_id */
    @ApiModelProperty("本人的broker_id")
    private Long brokerId;

    /** 上级的broker_id */
    @ApiModelProperty("上级的broker_id")
    private Long brokerUpId;

    /** 工号-机构内唯一 */
    @ApiModelProperty("工号-机构内唯一")
    private String brokerCode;

    @ApiModelProperty("下级的broker_id")
    private Long brokerDownId;

    /** 姓名 */
    @ApiModelProperty("姓名")
    private String fullName;

    @ApiModelProperty("营销区名称")
    private String teamName;
    /** 该关系是否生效 */
    @ApiModelProperty("该关系是否生效")
    private String status;

    @ApiModelProperty("入职时间")
    private Date employDate;

    @ApiModelProperty("推荐人名称")
    private String brokerUpName;

    @ApiModelProperty("推荐人工号")
    private String brokerUpCode;

    @ApiModelProperty("机构id")
    private String orgId;

    @ApiModelProperty("机构名称")
    private String orgName;

    /** 代理人角色信息 */
    @ApiModelProperty("代理人角色信息")
    private List<BrokerRoleVo> roles;


    private List<BrokerRelationVo> children;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BrokerRelationVo that = (BrokerRelationVo) o;
        return Objects.equals(brokerId, that.brokerId) && Objects.equals(brokerUpId, that.brokerUpId) && Objects.equals(brokerCode, that.brokerCode) && Objects.equals(fullName, that.fullName) && Objects.equals(status, that.status)  && Objects.equals(teamName, that.teamName)  && Objects.equals(children, that.children);
    }

    @Override
    public int hashCode() {
        return Objects.hash(brokerId, brokerUpId, brokerCode, fullName,status, teamName, children);
    }

    @Override
    public int compareTo(BrokerRelationVo o) {
        return (int) (brokerId-o.getBrokerId());
    }
}
